You can help by commenting or suggesting your edit directly into the transcript. We'll review any changes before posting them. All comments are completely anonymous. For any comments that need a reply, consider emailing training@inductiveautomation.com.
Version:
LESSON LIST
LESSON
Indirect Tag Binding
Description
An indirect Tag binding is very much like a standard Tag binding, except that you may introduce any number of indirection parameters to build a Tag path dynamically in the runtime.
Video recorded using: Ignition 8.1
Transcript
(open in window)[00:00] In this lesson, I'll demonstrate how to create an indirect tag binding to dynamically build a tag path in the runtime. If you look at my tag browser, you can see that I've already created some tank UDTs and I'd like to display these in my vision project. However, if I were to make a window for each instance, that could be time consuming and repetitive. Because of my current tag structure, the paths of each of these tags are very similar except for minor differences. I'll copy a couple of these paths to show you. Notice, that the only difference between the level tags of Tank 1 and 2 is the number of each tank. So I can take advantage of this and I can use an indirect tag binding to insert a parameter into the bindings tag path and select which tank I wanna view with a control component. I'll demonstrate this with a numeric text field and start with tank 1. Let's say that I wanna display the tank levels, so I'll add a cylindrical tank to display this. I'll add a binding to the tank's value property, and instead of a tag binding, I'll select an indirect tag binding.
[01:08] This will allow me to dynamically build a tag path that will resolve in the runtime. I'll start by selecting the tag icon to the right of the tag path field and selecting one of the tank level tags. Once I have an example tag path as my starting point, I can replace any part of this tag path with a parameter. In my case, the tag paths for each of the level_PV tags will only differ by the tank number. So I'll select the number here, delete it, and click the property icon to select a property on the window to substitute into the tag path. I'll find the numeric text field I just added, and then I wanna use the value (integer) property as my parameter. I'll click OK, and then you'll see that there are now some curly braces in the tag path that signify there's a parameter there, and if we look down at the references, we can see that reference 1 is linked to the numeric text field's value. I'll click OK to finish building this binding. Now my tank is showing a value of 30. Since the numeric text field has the number one in it, we should be seeing the level tag of tank 1, so I'll check to confirm, and sure enough, tank 1's, level_PV tag is 30. Now if I set this to two, I should see the value of tank 2's level_PV tag.
[02:17] And there we go, It's correctly pointing to tank two. And I can keep changing this and pointing to other tank numbers and continue to see the values that I want. That was a quick and easy way to set up a window that can dynamically point to any of my desired tanks, instead of manually building out a window for each individual tank. You can expand this idea to replace even more parts of the tag path and add as many parameters as you'd like if you wanted to dynamically point to different tags and different folders as well.